﻿@model rentit03_client.Controllers.MovieViewModel
@using (Html.BeginForm("Save", "Movie", FormMethod.Post, new { @class = "form-horizontal" }))
{
    @Html.ValidationSummary()
    <fieldset>
        <legend>Main</legend>
        <div class="control-group">
            @Html.LabelFor(model => model.Title, new { @class = "control-label" })
            <div class="controls">
                @Html.TextBoxFor(model => model.Title, new { @required = "required", @placeholder = "Media title" })
                @Html.ValidationMessageFor(model => model.Title)
            </div>
        </div>
        <div class="control-group">
            @Html.LabelFor(model => model.Year, new { @class = "control-label" })
            <div class="controls">
                @Html.TextBoxFor(model => model.Year, new { @type = "number", @class = "span1", @min = "1888", @max = "2012", @required = "required" })
                @Html.ValidationMessageFor(model => model.Year)
            </div>
        </div>
        <div class="control-group hide">
            <label class="control-label">
                Media type</label>
            <div class="controls">
                <label class="radio inline">
                    <input type="radio" name="type" value="movie" checked="checked" />
                    Movie
                </label>
                <label class="radio inline">
                    <input type="radio" name="type" value="ebook" />
                    E-book
                </label>
            </div>
        </div>
    </fieldset>
    <fieldset>
        <legend>Description</legend>
        <div class="control-group">
            @Html.LabelFor(model => model.Plot, new { @class = "control-label" })
            <div class="controls">
                @Html.TextAreaFor(model => model.Plot, new { @rows = 3, @placeholder = "Description" })
            </div>
        </div>
        <div class="control-group">
            @Html.LabelFor(model => model.Cover, new { @class = "control-label" })
            <div class="controls">
                @Html.TextBoxFor(model => model.Cover, new { @type = "url", @placeholder = "http://" })
                @Html.ValidationMessageFor(model => model.Cover)
            </div>
        </div>
        <div class="control-group">
            @Html.LabelFor(model => model.Genres, new { @class = "control-label" })
            <div class="controls">
                @Html.ListBoxFor(model => model.Genres, new MultiSelectList(Model.ListGenres), new { Multiple = "multiple", @class = "chosen" })
                <a id="add-genres" style="display: block" href="javascript:void()"><i class="icon-plus-sign">
                </i>Add new genres</a>
                <div id="add-genres-box" class="hide">
                    @Html.TextBoxFor(model => model.AddtionalGenres, new { @placeholder = "Additional new genres" })
                    <p class="help-block">
                        Seperate new genres with comma (,)</p>
                </div>
            </div>
        </div>
    </fieldset>
    <div class="movie-details">
        <fieldset>
            <legend>Movie</legend>
            <div class="control-group">
                @Html.LabelFor(model => model.Imdb, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextBoxFor(model => model.Imdb, new { @pattern = "tt[0-9]{7}", @placeholder = "tt#######" })
                    @Html.ValidationMessageFor(model => model.Imdb)
                    <p class="help-block">
                        http://www.imdb.com/title/<strong>tt#######</strong></p>
                </div>
            </div>
            <div class="control-group runtime">
                @Html.LabelFor(model => model.Hours, new { @class = "control-label" })
                <div class="controls">
                    <label class="pull-left">
                        @Html.TextBoxFor(model => model.Hours, new { @type = "number", @class = "span1", @min = "0", @max = "100" })
                        hour(s)&nbsp;</label>
                    <label class="pull-left">
                        @Html.TextBoxFor(model => model.Mins, new { @type = "number", @class = "span1", @min = "0", @max = "59" })
                        minute(s)</label>
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(model => model.Rating, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextBoxFor(model => model.Rating)
                    @Html.ValidationMessageFor(model => model.Rating)
                    <p class="help-block">
                        Motion Picture Rating</p>
                </div>
            </div>
        </fieldset>
    </div>
    <div class="book-details hide">
        <fieldset>
            <legend>Book</legend>
        </fieldset>
    </div>
    <fieldset>
        <legend>Details</legend>
        <div class="control-group">
            @Html.LabelFor(model => model.Languages, new { @class = "control-label" })
            <div class="controls">
                @Html.ListBoxFor(model => model.Languages, new MultiSelectList(Model.ListLanguages), new { Multiple = "multiple", @class = "chosen" })
                <a id="add-languages" style="display: block" href="javascript:void()"><i class="icon-plus-sign">
                </i>Add new languages</a>
                <div id="add-languages-box" class="hide">
                    @Html.TextBoxFor(model => model.AddtionalLanguages, new { @placeholder = "Additional new languages" })
                    <p class="help-block">
                        Seperate new languages with comma (,)</p>
                </div>
            </div>
        </div>
        <div class="control-group">
            @Html.LabelFor(model => model.Released, new { @class = "control-label" })
            <div class="controls">
                @Html.TextBoxFor(model => model.Released)
                @Html.ValidationMessageFor(model => model.Released)
            </div>
        </div>
    </fieldset>
    <div class="form-actions">
        @if (Model.Id > 0)
        {
            <input name="Id" type="hidden" value="@Model.Id" />
        }
        <button type="submit" class="btn btn-primary">
            Save</button>
        @if (Model.Id > 0)
        {
            @Html.ActionLink("Delete media", "Delete", "Movie", new { @id = Model.Id }, new { @class = "btn btn-warning" })
        }
        @Html.ActionLink("Cancel", "Index", "Movie", new { @id = Model.Id }, new { @class = "btn" })
    </div>
}